<template>
  <div>
    <router-view></router-view>
  </div>
</template>

<script>
import Vue from 'vue'
import { mapGetters } from 'vuex'

export default {
  name: 'tower',
  computed: {
    ...mapGetters({
      currentUser: 'currentUser'
    })
  },
  watch: {
    '$route' (to) {
      if (to.name === 'elevator') {
        this.push()
      }
    }
  },
  mounted () {
    this.push()
  },
  methods: {
    push () {
      if (this.currentUser.type === 1) {
        this.$router.push({name: 'companyElevator'})
      } else {
        this.$router.push({name: 'projectElevator'})
      }
    }
  }
}
</script>
